package cn.cctvcc.system.api;

import cn.cctvcc.core.constant.ServiceNameConstants;
import cn.cctvcc.core.domain.R;
import cn.cctvcc.system.api.domain.LoginUser;
import cn.cctvcc.system.api.domain.SysUser;
import cn.cctvcc.system.api.factory.RemoteSysUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 用户服务
 * @author: Jiang
 * @create: 2021-09-23 16:03
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteSysUserFallbackFactory.class)
public interface RemoteSysUserService {

    /**
     * 获取用户信息
     */
    @GetMapping(value = "sysUser/getUserByUserName/{userName}")
    R<LoginUser> getUserByUserName(@PathVariable("userName") String userName);

    /**
     * 检查用户是否唯一
     */
    @GetMapping(value = "sysUser/checkUserNameUnique/{userName}")
    R<String> checkUserNameUnique(@PathVariable("userName") String userName);

    /**
     * 新增用户信息
     */
    @PostMapping(value = "sysUser/add")
    R<SysUser> add(@RequestBody SysUser sysUser, @RequestParam("isRegister") Boolean isRegister);

    /**
     * 重置密码
     */
    @PutMapping(value = "sysUser/resetpass")
    R<Integer> resetpass(@RequestBody SysUser user);

}
